<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
       var arr=[20,10,30,21,32,8,1];
       function compare(a,b){
           return a-b;
       }
       arr.sort(compare);
       console.log(arr);




    </script>
</head>
<body>

</body>
</html>